#include<bits/stdc++.h>
using namespace std;
int n,m,t;
int a[400000];
int s[400000];
unordered_map<int,int>p[400000];
int dfs(int x,int ans)
{
    if(x==2)
    return ans;
    if(ans<=a[x])
    {
        if(p[x].find(ans)!=p[x].end())
        return p[x][ans];
        return p[x][ans]=dfs(x-1,a[x]-ans);
    }
    int i=1;
    for(;x-(1<<i)>=2;i++)
    if(ans-(s[x]-s[x-(1<<i)])<0)
    break;
    return dfs(x-(1<<(i-1)),ans-(s[x]-s[x-(1<<(i-1))]));
}
int main()
{
    freopen("pockets.in","r",stdin);
    freopen("pockets.out","w",stdout);
    scanf("%d",&n);
    for(int i=1;i<n;i++)
    scanf("%d",&a[i]),s[i]=s[i-1]+a[i];
    scanf("%d",&m);
    while(m--)
    scanf("%d",&t),printf("%d\n",dfs(n-1,t)+a[1]-a[2]);
    return 0;
}
